package com.lbw.factory.simplefactory.order;

import com.lbw.factory.simplefactory.pizza.ChessPizza;
import com.lbw.factory.simplefactory.pizza.GreekPizza;
import com.lbw.factory.simplefactory.pizza.Pizza;

/**
 * @author lbw
 * @version 1.0
 * @date 2021/9/5 20:27
 */
public class SimplePizzaFactory {

    public Pizza createPizza(String type) {
        Pizza pizza = null;

        System.out.println("使用简单工厂模式");

        if ("greek".equals(type)) {
            pizza = new GreekPizza("希腊披萨");
        } else if ("cheese".equals(type)) {
            pizza = new ChessPizza("芝士披萨");
        }
        return pizza;
    }
}
